<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>圆周运动</title>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        .box{
            width: 500px;
            height: 500px;
            position: absolute;
            left: 0;right: 0;top: 0;bottom: 0;
            margin: auto;
            border: 5px solid #58bc58;
            border-radius: 50%;
        }
        .move{
            width: 30px;
            height: 30px;
            background: red;
            border-radius: 50%;
            position: absolute;
        }
    </style>
</head>
<body>
    <div class="box">
        <div class="move"></div>
    </div>

    <script>
        // 获取元素及半径
        let box = document.querySelector('.box');
        let span = document.querySelector('.move');

        let bR = box.clientWidth/2;
        let sR = span.clientWidth/2;

        // 初始化角度、渲染
        let deg = 0;
        render();
        
        // 定时器
        setInterval(()=>{
            // 自增
            deg++;
            render();
        },10)

        // 渲染
        function render(){
            // 弧度
            let radian = (deg*Math.PI)/180;
            // 领边
            let lb = Math.cos(radian)*bR;
            // 对边
            let db = Math.sin(radian)*bR;
            
            // 定位
            span.style.left = lb + bR - sR+ 'px';
            span.style.top = db + bR - sR+ 'px';
        }
    </script>
</body>
</html>